<?php
namespace app\common\entity;

use think\Model;

class Image extends Model
{
    const STATUS_SHOW = 1;
    const STATUS_HIDDEN = 0;

    /**
     * @var string 对应的数据表名
     */
    protected $table = 'image';

    protected $autoWriteTimestamp = false;

    public static function getAllCate()
    {
        return [
            '1' => '商城广告',
            '2' => '游戏广告',
        ];
    }

    //获取类型
    public function getType($type)
    {
        switch ($type) {
            case 1:
                return '商城广告';
            case 2:
                return '游戏广告';
            default:
                return '';
        }
    }

    public function updImgUrl($str){
        $aa = preg_replace("/\/uploads/","../upload",$str);
        return $aa;
    }
}

